package com.humanmonth.util.effect
{
	import mx.core.UIComponent;
	import mx.effects.Glow;
	import mx.effects.Sequence;
	
	/**点击时发光
	 * 
	 * @author 林子龙
	 * 
	 */
	public class ClickGlowEffect
	{
		private var alphaSmall:Number=0.3;
		private var alphaBig:Number=0.5;
		private var blurSmall:Number=0;
		private var blurBig:Number=50;
		private var sequence:Sequence;
		private var color:uint=0xFFFFFF;
		private var duration:int=200;
		public function ClickGlowEffect():void
		{
			var glowBig:Glow=new Glow();
			glowBig.color=color;
			glowBig.alphaFrom=this.alphaBig;
			glowBig.alphaTo=this.alphaSmall;
			glowBig.blurXFrom=this.blurSmall;
			glowBig.blurXTo=this.blurBig;
			glowBig.blurYFrom=this.blurSmall;
			glowBig.blurYTo=this.blurBig;
			glowBig.duration=duration;
			var glowSmall:Glow=new Glow();
			glowSmall.color=color;
			glowSmall.alphaFrom=this.alphaSmall;
			glowSmall.alphaTo=this.alphaBig;
			glowSmall.blurXFrom=this.blurBig;
			glowSmall.blurXTo=this.blurSmall;
			glowSmall.blurYFrom=this.blurBig;
			glowSmall.blurXTo=this.blurSmall;
			glowSmall.duration=duration;
			this.sequence=new Sequence();
			this.sequence.addChild(glowBig);
			this.sequence.addChild(glowSmall);
		}
		
		public function applyEffect(obj:UIComponent):void{
			obj.setStyle("mouseDownEffect",sequence);
		}

	}
}